package com.wwinsoft.framework.dao.system;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.wwinsoft.framework.entity.system.CodeType;
import com.wwinsoft.modules.orm.hibernate.HibernateDao;

@Repository
@SuppressWarnings("unchecked")
public class CodeTypeDao extends HibernateDao<CodeType, Long> {
    public List<CodeType> getCachedAll() {
        Criteria criteria = this.createCriteria();
        criteria.setCacheable(true);
        return criteria.list();
    }

    public List<CodeType> getCachedMaintainedAll() {
        Criteria criteria = this.createCriteria();
        criteria.add(Restrictions.eq("needMaintain", true));
        criteria.setCacheable(true);
        return criteria.list();
    }
}